package netTracker;

import java.io.Serializable;

public class Track implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	/** An array of cells within the track. */
	Cell[] cells;
	/** The number of cells within the track. */
	int numCells;
	/** The pattern that contains this track.*/
	Pattern pattern;
	
	/**
	 * Constructs a track.
	 * @param cellCount the number of cells in the track.
	 * @param pattern the pattern that contains this track.
	 */
	public Track(int numCells, Pattern pattern){
		this.numCells = numCells;
		this.pattern = pattern;
		cells = new Cell[numCells];
		for (int i=0; i<cells.length; i++){
			cells[i] = new Cell();
		}
	}
	
	/** @return the array of cells in the track. */
	public Cell[] getCells(){
		return cells;
	}
	
	/** @return the number of cells in the track. */
	public int getNumCells(){
		return numCells;
	}
	
	public double getTempo() {
		return pattern.getTempo();
	}

	public void clear() {
		for (int i=0; i<cells.length; i++){
			cells[i].setNote(new Note(""));
		}
	}
}
